package org.ry.camera.tools;

import android.content.Context;
import android.graphics.PixelFormat;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;

public class WindowManagerTool {
	
	private static View mWindowlView = null;
	
	public static void startWindowManager(Context mContext,View mView){
		WindowManager mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
		WindowManager.LayoutParams mLayoutParams = new WindowManager.LayoutParams();
		mLayoutParams.type = LayoutParams.TYPE_PHONE; 
		mLayoutParams.format = PixelFormat.RGBA_8888;
		mLayoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
		mLayoutParams.height =WindowManager.LayoutParams.WRAP_CONTENT;
		mWindowManager.addView(mView, mLayoutParams);
		mWindowlView = mView;
	}
	public static void cancelWindowManager(Context mContext){
		WindowManager mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
		if(mWindowlView != null){
			mWindowManager.removeView(mWindowlView);
		}
		mWindowlView = null;
	}
}
